# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=py3-pytest
pkgver=8.3.3
pkgrel=0
pkgdesc="Python3 testing library"
url="https://docs.pytest.org/en/latest/"
arch="noarch"
license="MIT"
depends="
	py3-iniconfig
	py3-packaging
	py3-pluggy
	py3-py
	"
makedepends="py3-gpep517 py3-setuptools_scm py3-wheel"
checkdepends="bash py3-hypothesis py3-virtualenv py3-xmlschema"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/pytest/pytest-$pkgver.tar.gz
	"
builddir="$srcdir/pytest-$pkgver"
options="!check" # causes bootstrapping issues because of checkdepends

replaces="pytest" # Backwards compatibility
provides="pytest=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	SETUPTOOLS_SCM_PRETEND_VERSION="$pkgver" \
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages test-env
	test-env/bin/python3 -m installer .dist/pytest*.whl

	test-env/bin/python3 -m pytest
}

package() {
	mkdir -p "$pkgdir"/usr/bin

	local name; for name in py.test pytest; do
		ln -s $name-3 "$pkgdir"/usr/bin/$name
	done

	python3 -m installer -d "$pkgdir" \
		.dist/pytest*.whl
}

sha512sums="
7cdf76e33f20b1b2323de7341c203caa8d7b5505b5e774c55c6e30876e5b6f1405e12d54e7f1f0a1b15dbc0392bd83c7bb1928d25f06db3a15498c9d4cb4658b  pytest-8.3.3.tar.gz
"
